Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Raku lexer #476

Merged
merged 4 commits into from
Apr 27, 2021
Merged

Add Raku lexer #476

merged 4 commits into from
Apr 27, 2021

Conversation

CIAvash
Copy link
Contributor

@CIAvash CIAvash commented Apr 26, 2021

Fixes #306

@alecthomas
Copy link
Owner

Thanks, but CI failed.

@alecthomas
Copy link
Owner

Thanks, but CI is failing.

@alecthomas
Copy link
Owner

Also can you add a test? See lexers/README.md for details.

@CIAvash
Copy link
Contributor Author

CIAvash commented Apr 27, 2021

Circleci needs logging in, I find that ridiculous, so I can't see what is failing. When I used the Chroma command line tool there was no error.

@alecthomas
Copy link
Owner

Yes, that is annoying I agree. The failure is linter failures. You'll need golangci-lint 1.26.0 to check this locally.

lexers/r/raku.go:1447: unnecessary leading newline (whitespace)
lexers/r/raku.go:1142:5: ifElseChain: rewrite if-else to switch statement (gocritic)
lexers/r/raku.go:1414:2: ifElseChain: rewrite if-else to switch statement (gocritic)
lexers/r/raku.go:1232:15: Error return value of `podFormatter` is not checked (errcheck)
lexers/r/raku.go:756:73: `archtypes` is a misspelling of `archetypes` (misspell)
lexers/r/raku.go:639:2: exported const RakuQuote should have comment (or a comment on this block) or be unexported (golint)
lexers/r/raku.go:1146:6: should replace `nestingLevel += 1` with `nestingLevel++` (golint)
lexers/r/raku.go:1150:6: should replace `nestingLevel -= 1` with `nestingLevel--` (golint)
lexers/r/raku.go:1252:2: exported const TopRule should have comment (or a comment on this block) or be unexported (golint)
lexers/r/raku.go:17: File is not `gofmt`-ed with `-s` (gofmt)

@CIAvash
Copy link
Contributor Author

CIAvash commented Apr 27, 2021

This is unrelated, it says change ifElseChain to switch, but then what is the point of if else?

Copy link
Owner

@alecthomas alecthomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I just looked at the actual code. I hadn't realised that you'd manually written this lexer. Impressive work, thank you!

Just one small comment, but otherwise LGTM.

@@ -260,7 +260,7 @@ go get -u github.com/alecthomas/chroma/cmd/chroma

- Quite a few lexers, for various reasons (pull-requests welcome):
- Pygments lexers for complex languages often include custom code to
handle certain aspects, such as Perl6's ability to nest code inside
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence now no longer makes sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only removed the perl6 part and missed the regular expressions part.
Do you mean the whole "Pygments lexers for complex languages often include custom code to..." part. or just that "regular expressions part"?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just mean it now reads "handle certain aspects regular expressions", which doesn't make sense. Maybe just revert this, or did you mean to change it to Raku?

@CIAvash
Copy link
Contributor Author

CIAvash commented Apr 27, 2021

Wow, I just looked at the actual code. I hadn't realised that you'd manually written this lexer. Impressive work, thank you!

Just one small comment, but otherwise LGTM.

Hehe, yeah it took me about two to three weeks! I started from the lexer generated by pygments2chroma.py, but changed and added a lot of things

@alecthomas
Copy link
Owner

Awesome, thanks!

@alecthomas
Copy link
Owner

Sorry, I meant to merge this!

@alecthomas alecthomas merged commit 9de08fc into alecthomas:master Apr 27, 2021
@CIAvash CIAvash deleted the raku branch April 28, 2021 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Raku programming language
2 participants